import request from '@/config/axios'

// 班级信息 VO
export interface ExamClassVO {
  id: number // 班级ID
  className: string // 班级名称
  classCode: string // 班级编码
  grade: string // 年级
  teacherId: number // 班主任ID
  studentCount: number // 学生人数
  description: string // 班级描述
  status: number // 状态：1-正常，0-停用
}

// 班级信息 API
export const ExamClassApi = {
  // 查询班级信息分页
  getExamClassPage: async (params: any) => {
    return await request.get({ url: `/system/exam-class/page`, params })
  },

  // 查询班级信息详情
  getExamClass: async (id: number) => {
    return await request.get({ url: `/system/exam-class/get?id=` + id })
  },

  // 新增班级信息
  createExamClass: async (data: ExamClassVO) => {
    return await request.post({ url: `/system/exam-class/create`, data })
  },

  // 修改班级信息
  updateExamClass: async (data: ExamClassVO) => {
    return await request.put({ url: `/system/exam-class/update`, data })
  },

  // 删除班级信息
  deleteExamClass: async (id: number) => {
    return await request.delete({ url: `/system/exam-class/delete?id=` + id })
  },

  // 导出班级信息 Excel
  exportExamClass: async (params) => {
    return await request.download({ url: `/system/exam-class/export-excel`, params })
  },

  // 获取所有班级列表
  getAllExamClasses: async () => {
    const data = await request.get({ url: `/system/exam-class/page`, params: { pageNo: 1, pageSize: 1000 } })
    return data.list || []
  },
}
